package org.ws.edu.dao;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

public abstract class GenericDao<T> {

    protected HibernateTemplate hibernateTemplate;

    public void setSessionFactory(SessionFactory sessionFactory) {
        hibernateTemplate = new HibernateTemplate(sessionFactory);
    }

    public void create(T object) {
        hibernateTemplate.save(object);
    }

    public void delete(T object) {
        hibernateTemplate.delete(object);
    }

    public void update(T object) {
        hibernateTemplate.update(object);
    }

    public abstract T get(Long id);

    public abstract List<T> getList();

    public abstract void delete(Long id);
}
